#include "ControlMessage.h"

#include "FastJsoncpp.h"
#include "json/value.h"

ControlMessage::ControlMessage() {}

inline Json::Value ControlMessage::toJsonObject() const
{
    // NOT REQUIRED
    Json::Value json;
    return json;
}
inline bool ControlMessage::fromJsonObject(const Json::Value& object)
{
    if (object.isNull())
        return false;
    _origJson = object;

    _event = FastJsoncpp::GET_STR(object, "msgName");
    _conferenceId = FastJsoncpp::GET_STR(object, "confId");
    _number = FastJsoncpp::GET_STR(object, "number");
    _content = FastJsoncpp::GET_STR(object, "content");
    _sequence = FastJsoncpp::GET_INT(object, "msgCseq");
    if (_event.empty() || _number.empty() || _conferenceId.empty())
        return false;

    return true;
}
const std::string& ControlMessage::getConferenceId() const
{
    return _conferenceId;
}
const std::string& ControlMessage::getNumber() const
{
    return _number;
}
const std::string& ControlMessage::getEvent() const
{
    return _event;
}
int ControlMessage::getSequence() const
{
    return _sequence;
}
const std::string& ControlMessage::getContent() const
{
    return _content;
}

const Json::Value& ControlMessage::getOrigRequestData() const
{
    return _origJson;
}